package com.itrus.auth.demo.person.face;

import com.itrus.auth.demo.core.BaseAuth;
import com.itrus.auth.demo.core.Config;
import com.itrus.auth.demo.person.basic.PersonBasicAuth;

import java.util.HashMap;
import java.util.Map;

/**
 * @author : peigen
 * @since: 2023/8/2 18:08
 */
public class H5FaceCheckSilentAuth extends BaseAuth {

    protected String REQUEST_PATH = "/h5/bodyFaceCheck";
    protected String SERVICE_CODE = "idc2001";


    public H5FaceCheckSilentAuth(Config config) {
        super.config = config;
    }

    /**
     * H5活体人脸验证
     *
     * @param name            姓名
     * @param idCard          身份证号
     * @param orderNo
     * @param videoFileBase64 base64视频 3M以内
     */
    public void auth(String name, String idCard, String videoFileBase64) {
        Map<String, String> requestMap = new HashMap<>(8);
        requestMap.put("appId", config.getAppId());
        requestMap.put("serviceCode", SERVICE_CODE);
        requestMap.put("name", name);
        requestMap.put("idnumber", idCard);
        requestMap.put("videoFile", videoFileBase64);

        doRequest(REQUEST_PATH, requestMap);
    }

    @Override
    public String getServiceCode() {
        return SERVICE_CODE;
    }
}
